home *** CD-ROM | disk | FTP | other *** search
- Path: news.lpr.carel.fi!usenet
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.lang.c
- Subject: Re: Help!
- Date: Fri, 26 Jan 1996 17:38:57 +0200
- Organization: Carelcomp Forest
- Message-ID: <3108F591.5BC2@cmt.lpr.mail.carel.fi>
- References: <4ea5p4$j0s@ratree.psu.ac.th>
- NNTP-Posting-Host: renoir.cclahti.carel.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (WinNT; I)
-
- Sanon CHAOCHAIYAPORN wrote:
- >
- > Dear all
- >
- > There is a file, hi.bat, in my 'h:\data' directory and I try to
- > run it by C program but it fail. Please, advice to me?
- >
- > Source:
- >
- > #include<stdio.h>
- > #include<stdlib.h>
- > #include<conio.h>
- > #include<dir.h>
- >
- > main()
- > {
- > clrscr();
- > chdir("h:\data");
- > system("hi.bat");
- > getch();
- > }
- >
-
- You must be kidding? First, rename the file to hi.c, compile it using a C
- compiler, link it using a linker and then run the executable (hi.exe) produced.
- This will of course change the line system to run "hi.exe". Also, you might
- want to declare main as int main(int argc, char **argv)...
-
- If you really want to do it as a BAT file, rewrite hi.bat as:
-
- :lbl
- cls
- cd h:\data
- pause
- goto lbl (or, if you want: hi.bat)
-
- and just start it from the command prompt.
-
- Later,
- AriL
- --
- All my opinions are mine and mine alone.
-